﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace EMR
{
    public class PatientBll
    {
        public static bool AddPatient(Patient patient)
        {
            if(PatientDal.AddPatient(patient)==1 )
            {
                MessageBox.Show("添加成功！");
                return true;
            }
            else
            {                                                                                              //否则；
                MessageBox.Show("添加失败！");
                return false; 
            }
        }

        public static bool UpdatePatient(Patient patient,string beforeAdNo,string beforeBedNo)
        {
            if (PatientDal.UpdatePatient(patient,beforeAdNo,beforeBedNo) == 1)
            {
                MessageBox.Show("修改成功！");
                return true;
            }
            else
            {                                                                                              //否则；
                MessageBox.Show("修改失败！");
                return false;
            }
        }

        public static bool DeletePatient( string BedNo,string Name, string AdNo)
        {
            if (PatientDal.DeletePatient(BedNo,Name,AdNo) == 1)
            {
                MessageBox.Show("删除成功！");
                return true;
            }
            else
            {                                                                                              //否则；
                MessageBox.Show("删除失败！");
                return false;
            }
        }

        public static SqlDataReader load(string bedNo ,string name ,string AdNo)
        {
            return PatientDal.SelectPatient(bedNo, name, AdNo);
        }
        public static SqlDataReader SelectOne(string condition )
        {
            return PatientDal.SelectOne(condition);
        }
        

        public static SqlDataReader LoadAll()
        {
            return PatientDal.SelectAll();
        }
    }

}
